package org.jbpm.pvm.internal.cmd;

import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.jbpm.pvm.internal.session.RepositorySession;

public class RenameDeploymentResourceCmd implements Command<Void> {
	private static final long serialVersionUID = 1L;

	protected String deploymentId;
	protected String initResourceName;
	protected String resourceName;

	public RenameDeploymentResourceCmd(String deploymentId,
			String initResourceName, String resourceName) {
		this.deploymentId = deploymentId;
		this.initResourceName = initResourceName;
		this.resourceName = resourceName;
	}

	public Void execute(Environment environment) throws Exception {
		RepositorySession repositorySession = environment
				.get(RepositorySession.class);
		repositorySession.renameDeploymentResource(deploymentId,
				initResourceName, resourceName);
		return null;
	}
}
